#ifndef __NEWLOG_H__
#define __NEWLOG_H__

#include "stdarg.h"
#include <string>
//#include "log.h"

#define MAX_LOG_SIZE 4096


typedef enum _LOG_LEVEL{
	LogLevelHead = 0,
	LogLevelFatal,
	LogLevelError,
	LogLevelWarn,
	LogLevelInfo,
	LogLevelDebug,
	StartLog = 10,
	EndLog
} LOG_LEVEL, *PLOG_LEVEL;

VOID OutputLog(LOG_LEVEL dwLoglevel, const char* format, ...);

#define LOG_MESSAGE(dwLoglevel, fmt, ...) {\
	std::string format("%s,%d,%s,"); \
	format.append(fmt); \
	OutputLog(dwLoglevel, format.c_str(), __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); \
}

#define StartLog() 				OutputLog(StartLog, "%s,%d,%s,begin.", __FILE__, __LINE__, __FUNCTION__ )
#define EndLog()				OutputLog(EndLog, "%s,%d,%s,end.", __FILE__, __LINE__, __FUNCTION__ )
#define DebugLog( fmt, ... )	LOG_MESSAGE( LogLevelDebug, fmt, __VA_ARGS__ )
#define InfoLog( fmt, ... )		LOG_MESSAGE( LogLevelInfo, fmt, __VA_ARGS__ )
#define WarnLog( fmt, ... )		LOG_MESSAGE( LogLevelWarn, fmt, __VA_ARGS__ )
#define ErrorLog( fmt, ... )	LOG_MESSAGE( LogLevelError, fmt, __VA_ARGS__ )
#define FatalLog( fmt, ... )	LOG_MESSAGE( LogLevelFatal, fmt, __VA_ARGS__ )

#define DBGOUT( fmt, ... )		LOG_MESSAGE( LogLevelDebug, fmt, __VA_ARGS__ )
//#define DBGOUT( int, fmt, ... )		LOG_MESSAGE( LogLevelDebug, fmt, __VA_ARGS__ )

#endif

DWORD GetLogLevel();
DWORD GetOriginalLogLevel();
BOOL GetLogPath(char* pchPathBuffer, DWORD dwBufferSize);
BOOL isDebugEnable();
BOOL SetDebugLogName( HANDLE hModule );
BOOL SetDebugLogName( LPCSTR lpName );